#include <iostream>
using namespace std;

//#include <stack>
//#include <queue>


#include "BitTrain.h"
#include "BitTrain2.h"

void test_stack()
{
	//bit::stack<int,vector<int>> s;  //数组栈
	//bit::stack<int, list<int>> s; //链表栈
	bit::stack<int> s;

	s.push(1);
	s.push(2);
	s.push(3);
	s.push(4);
	while (!s.empty())
	{
		cout << s.top() << " ";
		s.pop();
	}
	cout << endl;
}


void test_queue()
{
	bit::queue <int> q;
	q.push(1);
	q.push(2);
	q.push(3);
	q.push(4);
	while (!q.empty())
	{
		cout << q.front() << " ";
		q.pop();
	}
	cout << endl;
}

void test_priority_queue()
{
	//vector<int> v = { 3,2,7,6,0,4,1,9,8,5 };
	///*priority_queue<int> q1;
	//for (auto& e : v)
	//	q1.push(e);*/

	//priority_queue<int> q1(v.begin(), v.end());

	int a[] = { 2,1,7,6,0,4,3,9,8,5 };
	// 默认是大堆
	bit::priority_queue<int> q1(a, a+sizeof(a)/sizeof(int));
	// 小堆
	bit::priority_queue<int, vector<int>, bit::greater<int>> q2(a, a + sizeof(a) / sizeof(int));

	cout << "大堆：" << " ";
	while (!q1.empty())
	{
		cout << q1.top() << " ";
		q1.pop();
	}
	cout << endl;

	cout << "小堆：" << " ";
	while (!q2.empty())
	{
		cout << q2.top() << " ";
		q2.pop();
	}
	cout << endl;

}

int main()
{
	test_stack();
	test_queue();
	test_priority_queue();

	return 0;
}